#!/bin/sh
#
# Copyright (c) Citrix Systems 2008. All rights reserved.
#

# Runs on the George master when performing a rolling upgrade from Orlando

set -e

. @INVENTORY@
XE="@BINDIR@/xe"

# Clean all unreferenced patches out of the db now that the upgrade is complete.
# When upgrading to 5.0, this should clean out all 4.1 patches at the end.
function clean_patches {
    IFS=,
    for pool_patch in $(xe patch-list --minimal params=uuid hosts=) ; do
        xe patch-destroy uuid=${pool_patch}
    done
}

case "$1" in
  start)
    
  ;;
  stop)
    # Clean up patches
    clean_patches
  ;;
esac
